package ac.github.os.internal.core.condition.impl.player

import ac.github.os.internal.core.condition.Condition
import ac.github.os.internal.core.condition.call
import ac.github.os.internal.core.config.StringConfig
import ac.github.os.internal.core.config.get
import ac.github.os.internal.core.trigger.PlayerTrigger
import ac.github.os.internal.session.Session
import taboolib.common.platform.Awake

@Awake
class SneakingCondition : Condition {
    override fun doScreen(session: Session, config: StringConfig): Boolean {
        val b = config.get<Boolean>("val", single = true) ?: return false
        return session.call<PlayerTrigger> {
            it.player.isSneaking == b
        }
    }

    override val namespace: String
        get() = "sneaking"
}